/*
# File    :   spi.c
# Author  :   SCHIPS
# Mail    :   schips@dingtalk.com
# Date    :   Tue, Apr 30, 2019  4:04:21 PM
# Note    :   SPI with R/W SD card demo based on C51
*/
#ifndef _SD_CARD_H_
#define _SD_CARD_H_
#include <reg52.h>
#include <intrins.h>
#include <stdio.h>
#include <9325TP.h>

#include "spi.h"
//============================================================
//检测SD卡的响应
unsigned char SdResponse();

//================================================================
//发命令到SD卡
void SdCommand(unsigned char command, unsigned long argument, unsigned char CRC);
//================================================================
//初始化SD卡
unsigned char SdInit(void);
//================================================================
//往SD卡指定地址写数据,一次最多512字节
unsigned char SdWriteBlock(unsigned char *Block, unsigned long address,int len);

//=======================================================================
//从SD卡指定地址读取数据,一次最多512字节
unsigned char SdReadBlock(unsigned char *Block, unsigned long address,int len);
void Com_Init(void);
#endif /* ifndef _SD_CARD_H_ */
